package wyy02;

public class Student extends Person{
    private String ID;
    private double scoreEn;
    private double scoreMath;
    private double scoreCh;

    public Student(String name, int age, String sex, String ID, double scoreEn, double scoreMath, double scoreCh) {
        super(name, age, sex);
        this.ID = ID;
        this.scoreEn = scoreEn;
        this.scoreMath = scoreMath;
        this.scoreCh = scoreCh;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }

    public double aver() {//平均分
        return (scoreEn + scoreMath + scoreCh) / 3;
    }

    public double max() {
        return Math.max(scoreEn, Math.max(scoreMath, scoreCh));
    }

    public double min() {
        return Math.min(scoreEn, Math.min(scoreMath, scoreCh));
    }


    @Override
    public String toString() {
        return "学生：【" +
                "姓名：" + getName() + '\'' +
                ", 年龄：" + getAge() + '\'' +
                ", 性别：" + getSex() + '\'' +
                "学号" + ID + '\'' +
                ", 英语成绩" + scoreEn +
                ", 数学成绩：" + scoreMath +
                ", 语文成绩：" + scoreCh +
                '】';
    }
}
